classdef Words < handle
    %Words Summary of this class goes here
    %   Example for operator overloading
    
    properties
        MyWord      %our character array
    end
    
    methods
        
        function obj=Words(InChar) %Contructor
           obj.MyWord=InChar; 
        end
        
        function disp(obj)
            fprintf('%s\n',obj.MyWord) %This is called object is displayed in command window
        end
        
        function obj3=plus(obj1,obj2) %This is called we attempt to add objects of this class
            S1=obj1.MyWord;
            S2=obj2.MyWord;
            S3=cat(2,S1,' ',S2);
            %Create new object (This is a better idea than modifying objects)
            obj3=Words(S3);
        end
  
    end
    
end

